<template>
  <div class="index">
    <el-container class="aside">
      <MyAside></MyAside>
      <el-container>
        <el-main>
          <!-- 二级路由组件渲染出口 -->
          <router-view v-if="isRouterAlive"></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import MyAside from "../components/MyAside.vue";
export default {
  //以下是局部刷新方法
  data() {
    return {
      isRouterAlive: true,
    };
  },
  provide() {
    //提供
    return {
      reload: this.reload,
    };
  },
  methods: {
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(function () {
        this.isRouterAlive = true;
      });
    },
  },
  components: {
    MyAside,
  },
};
</script>

<style lang="scss">
.aside,
.index {
  height: 100%;
}
</style>